<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up()
    {
        Schema::create('lottery_results', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('wechat_users_id');
            $table->unsignedBigInteger('verification_codes_id')->nullable();
            // 外键约束将在后续迁移中添加
            // $table->foreign('wechat_users_id')->references('id')->on('wechat_users')->onDelete('cascade');
            // $table->foreign('verification_codes_id')->references('id')->on('verification_codes')->onDelete('set null');
            $table->timestamp('draw_time')->useCurrent(); // 摇奖时间
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::dropIfExists('lottery_results');
    }
}; 